import request from '@/utils/request'

export const saveProduct = (form) => 
    request({
        url: '/op/product/create_product',
        method: 'post',
       	data:JSON.stringify(form)

    })

export  const  ListProduct = (url,search) =>
	request ({
		url,
        method: 'get',
        params: {
            pageSize: search.limit,
            keyWord: search.name,
            pageNo:search.currentPage,
            type:search.pro_type,
        } 
	})

export const modifyProduct = (form) => 
    request({
        url: '/op/product/modify_product',
        method: 'post',
        data:JSON.stringify(form)
    })
    
export const del_Product = (code) => 
    request({
        url: '/op/product/delete_product',
        method: 'get',
        params:{
            code
        }
    })
/*标记删除*/
export const removeProduct_badge = (code) => 
    request({
        url: '/op/product/mark_delete_product',
        method: 'get',
        params:{
            code
        }
    })

export const removeCancel_badge = (code) => 
    request({
        url: '/op/product/mark_delete_product_cancel',
        method: 'get',
        params:{
            code
        }
    })
    // 暂废
export  const  saveAddBiao = (code,name) =>
    request({
        url: '/op/product_object/create_product_object',
        method: 'post',
        data: JSON.stringify({
            prdCode:code,
            name
        }) 
    })

export  const  detailProduct = (code) =>
    request({
        url: '/op/product/get_product',
        method: 'get',
        params: {
            code
        }
    })

//增加产品募集信息
export  const  addCollect = (form) =>
    request({
        url: '/op/product_raise_log/create_product_raise_log',
        method: 'post',
        data: JSON.stringify({
            prdCode:form.prdCode,
            prjCode:form.prjCode,
            
            weekRaiseAmt:form.weekRaiseAmt,
            monthRaiseAmt:form.monthRaiseAmt,
            totalRaiseAmt:form.totalRaiseAmt,
            listingCharged:form.listingCharged,
            
            dataTimeYear:form.dataTimeYear,
            dataTimeMonth:form.dataTimeMonth,
            dataTimeWeek:form.dataTimeWeek,
        })
    })


//列表产品募集信息
export  const  listCollect = (search,prdCode) =>
    request({
        url: '/op/product_raise_log/get_product_raise_log_list',
        method: 'get',
        params: {
            pageNo:search.pageNo,
            pageSize:search.pageSize,
            prdCode
        }
    })

//修改 产品募集信息记录
export  const  modifyCollect = (form) =>
    request({
        url: '/op/product_raise_log/modify_product_raise_log',
        method: 'post',
        data: JSON.stringify({
            code:form.code,

            weekRaiseAmt:form.weekRaiseAmt,
            monthRaiseAmt:form.monthRaiseAmt,
            totalRaiseAmt:form.totalRaiseAmt,
            listingCharged:form.listingCharged,

            dataTimeYear:form.dataTimeYear,
            dataTimeMonth:form.dataTimeMonth,
            dataTimeWeek:form.dataTimeWeek,
        })
    })


//复制 产品
export  const  copyProduct = (code) =>
    request({
        url: '/op/product/copy_product',
        method: 'get',
        params: {
           code
        }
    })